<template>
<div>
    <el-card class="box-card">
        <el-form :model="numberValidateForm" ref="numberValidateForm" label-width="100px" class="demo-ruleForm">
            <el-form-item
                label="配件名称"
                :rules="[
      { required: true, message: '配件名称不能为空'}
    ]"
            >
                <el-input type="text" v-model="numberValidateForm.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item
                label="配件编号"
            >
                <el-input type="text" v-model="numberValidateForm.number" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item
                label="配件机型"
            >
                <el-input type="text" v-model="numberValidateForm.jixing" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item
                label="类型"
            >
                <el-input type="text" v-model="numberValidateForm.leixing" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item
                label="备注"
            >
                <el-input type="text" v-model="numberValidateForm.demo" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item
                label="状态"
            >
                <el-input type="text" v-model="numberValidateForm.zhuangtai" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="saveSpare(numberValidateForm)">提交</el-button>
                <el-button @click="reset">重置</el-button>
            </el-form-item>
        </el-form>
    </el-card>

</div>
</template>

<script>
export default {
    data() {
        return {
            numberValidateForm: {
                name:'',
                number:'',
                jixing:'',
                leixing:'',
                demo:'',
                zhuangtai:''
            }
        };
    },
    methods: {
        saveSpare(data){
            this.$http.post("/v1/spare/save",data).then(res => {
                this.numberValidateForm = {}
                this.$notify({
                    title: '成功',
                    message: '添加成功',
                    type: 'success'
                });
            })
        },
        reset(){
            this.numberValidateForm = {}
        }
    }
}
</script>

<style scoped>

</style>
